import cgi

from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app

import myrss
import StringIO

fpickle = StringIO.StringIO()
frss = StringIO.StringIO()

class MainPage(webapp.RequestHandler):
  def get(self):
#    self.response.out.write("""
#      <html>
#        <body>
#          <form action="/sign" method="post">
#            <div><textarea name="content" rows="3" cols="60"></textarea></div>
#            <div><input type="submit" value="Sign Guestbook"></div>
#          </form>
#        </body>
#      </html>""")

	
	myrss.SavedRSS = myrss.SavedData('googrss')
	myrss.JobrapidoFeed.load("Annunci JobRapido",myrss.url,"Tutti gli annunci di jobrapido erp",self.response.out,'googpick',50)
#	myrss.SavedRSS.Write()


class Guestbook(webapp.RequestHandler):
  def post(self):
    self.response.out.write('<html><body>You wrote:<pre>')
    self.response.out.write(cgi.escape(self.request.get('content')))
    self.response.out.write('</pre></body></html>')

application = webapp.WSGIApplication(
                                     [('/', MainPage),
                                      ('/sign', Guestbook)],
                                     debug=True)

def main():
  run_wsgi_app(application)

if __name__ == "__main__":
  main()
